package com.share.example.stock.schedule;

import com.share.common.utils.DateExtUtil;
import com.share.example.stock.service.ITradeDateService;
import com.share.example.stock.service.StrategyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;


/**
 * 板块和详情数据下载
 */

@Slf4j
@Component
public class S55_Strategy {
    private String className = this.getClass().getSimpleName();
    @Autowired
    private StrategyService strategyService;
    @Autowired
    private ITradeDateService iTradeDateService;


    // "0 18 23 * * ?" 每天晚上18点15执行一次
    @Scheduled(cron = "0 10 10,11,14,16 * * ?")
    public void checkName() {
        Date date = new Date();
        //对时间再次细分
        int intDate = DateExtUtil.getTimeInt(date);
        if ((intDate > 93100 && intDate < 115000) || (intDate > 130500 && intDate < 152000) || (intDate > 230000 && intDate < 232500)) {
            //可以使用的时间
        } else {
            log.info("不满足时间直接退出");
            return;
        }

        //周日直接跳过
        if (!iTradeDateService.isTradeDay(date)) {
            log.info("非交易日直接退出");
            return;
        }

        int a = strategyService.checkName();
    }
}
